home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / AmiVoGL_MDEV.lha / examples / floc.F < prev    next >
Text File  |  1991-06-03  |  1KB  |  92 lines

  1. c
  2. c a routine to demonstrate using locator.
  3. c
  4.     program flocator
  5.  
  6. #ifdef SGI
  7. #include "fgl.h"
  8. #include "fdevice.h"
  9. #else
  10. #include "fvogl.h"
  11. #include "fvodevice.h"
  12. #endif
  13.  
  14.     integer bt
  15.     integer *2 x, y, sx, sy
  16.     logical act, curpnt
  17.     integer *2 val, vminx, vmaxx, vminy, vmaxy
  18. c
  19. c Note the declaration of the function locator below
  20. c
  21.  
  22.     call winope('floc', 4)
  23.         call getvie(vminx, vmaxx, vminy, vmaxy)
  24.  
  25.     xmin = vminx
  26.     xmax = vmaxx
  27.     ymin = vminy
  28.     ymax = vmaxy
  29.  
  30.         call ortho2(xmin, xmax, ymin, ymax)
  31.  
  32.     call color(BLACK)
  33.     call clear
  34.  
  35.     call color(BLUE)
  36.  
  37. c
  38. c    draw some axes
  39. c
  40.     y = (vmaxy - vminy) / 2
  41.         call move2s(vminx, y)
  42.         call draw2s(vmaxx, y)
  43.  
  44.     x = (vmaxx - vminx) / 2
  45.         call move2s(x, vminy)
  46.         call draw2s(x, vmaxy)
  47.  
  48.     call color(GREEN)
  49.  
  50. c
  51. c    enable the mouse buttons
  52. c
  53.         call unqdev(INPUTC)
  54.         call qdevic(LEFTMO)
  55.         call qdevic(MIDDLE)
  56.  
  57.  
  58.     act = .false.
  59.     curpnt = .false.
  60. c
  61. c    qread waits for a mouse event and getval tells us
  62. c    the valuator's value. In this case it's the X and Y
  63. c    positions of the mouse.    Note: these come back to us in
  64. c    screen coordinates.
  65. c
  66.  
  67. 1    continue
  68.         bt = qread(val)
  69.         sx = getval(MOUSEX)
  70.         sy = getval(MOUSEY)
  71.  
  72.         if (bt .eq. MIDDLE) then
  73.             call gexit
  74.             stop
  75.         else if (act) then
  76.             act = .false.
  77.             call move2s(sx, sy)
  78.             call draw2s(x, y)
  79.         else 
  80.             act = .true.
  81.             x = sx
  82.             y = sy
  83.         end if
  84.  
  85. c
  86. c        swallow the up event...
  87. c
  88.         bt = qread(val)
  89.     goto 1
  90.  
  91.     end
  92.